// Update the BASE_URL to include a fallback if the server is unreachable
export const BASE_URL = process.env.NEXT_PUBLIC_API_URL || "https://test.api.thynergy.cn"

// Add a function to check if the API is available
export async function isApiAvailable() {
  try {
    const axios = (await import("axios")).default
    await axios.get(`${BASE_URL}/health`, { timeout: 3000 })
    return true
  } catch (error) {
    console.warn("API appears to be unavailable:", error)
    return false
  }
}
